package org.example.java.regExp;

import java.util.Arrays;

/**
 * Created by Juntao.Zhang on 2014/5/22.
 */
public class Splitting {
  static String knights = "Then, when you have found the shrubbery, you must cut not on a";

  public static void split(String regex) {
    System.out.println(Arrays.toString(knights.split(regex)));
  }

  // \W 非单词字符
  // \w 单词字符
  public static void main(String[] args) {
    split(" ");
    split("\\W+");//non-word characters
    split("n\\W+");//'n' followed by non-word characters
  }
}
